package thread.thread_04_17;

import java.util.concurrent.TimeUnit;

/**
 * @author bruin_du
 * @description 观察线程现象
 * @date 2022/5/2 10:51
 **/
public class TreadTest {
    static class SomeThead extends Thread{
        @Override
        public void run() {
            while(true){
                System.out.println("我是另一个线程（执行流B）");
                try {
                    TimeUnit.SECONDS.sleep(1);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }
    }

    public static void main(String[] args) {
        SomeThead thead = new SomeThead();
        thead.start();

        while(true){
            System.out.println("我是主线程（执行流A）");
            try {
                TimeUnit.SECONDS.sleep(1);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}

